package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    //select setmeal_id form setmeal_dish where dish_id in (?,?,?)

    /**
     * 通过菜品ID查找关联的套餐ID
     * @param dishIds
     * @return
     */
    List<Long> getSetmealByDishIds(List<Long> dishIds);

    /**
     * 批量添加套餐-菜品关系信息
     * @param setmealDishes
     */
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     * 批量删除套餐-菜品关系信息
     * @param setmealIds
     */
    void deleteBatch(List<Long> setmealIds);

    /**
     * 根据套餐id查询关联菜品
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> selectBySetmealId(Long setmealId);
}
